PSA Object Model Diagrams

ResourceSearchService

global with sharing class ResourceSearchService implements API

a service that queries the resource (contact) object using filters for security controls, region/practice/group, skills, utilization, and others. Queries can be set to return resources that do not exactly match the filter criteria (fuzzy matching). When fuzzy matching is enabled, depending on a specified preference resources may be returned that do not match the region, practice, and group filters. Certain additionalContactFilters can also be set to fuzzy match when fuzzy matching is enabled. (Currently the only additionalContactFilter that can be set to be fuzzy is resource role.) The level of preference for these filters can be defined by weightings in the Resource Search Service custom settings. The priority of weightings is Essential (must match), Ideal, Desirable, then Suggested. When using fuzzy matching the returned resources are ordered so that the best matching resources occur first. This order supersedes any requested order specified by the filter's orderByFields. A good match is determined firstly by how well the filter criteria match, then by the overall skill ratings, and finally the availability.

Methods

execute

global static List<Contact> execute(ResourceSearchService.ResourceSearchFilter filter)

The execute method searches for resources that meet the supplied criteria. Note if the search criteria use encrypted fields, the results cannot be sorted or filtered and an error displays.

Input Parameters

Name Type Description
filter ResourceSearchService.ResourceSearchFilter An instance of the ResourceSearchService.ResourceSearchFilter class that supplies the search criteria.

Return Value

Returns a list of Contact records with the requested fields and skills, and optionally additional utilization related fields.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

debug

global static String debug()

The debug method provides diagnostic information about the status of the generated query.

Return Value

Returns a string containing the generated queries and any error messages

ResourceSearchService

global ResourceSearchService()

Comparison used by availability filters

ResourceSearchService.ResourceSearchFilter

global class ResourceSearchFilter

used to define the criteria to be used by the resource search api execute method.

Properties

Name Type Description
maxReturnedResults Integer defines the maximum number of results to return.
fieldsToSelect Set<String> specifies the contact object fields to retrieve.
skillsToSelect Set<ID> specifies the skill records associated with the contact to retrieve.
orderByFields List<String> specifies the contact object fields by which to sort the results. this is not considered by fuzzy matching.
additionalContactFilters List<ResourceSearchService.ResourceSearchFilterField> refines search results using filters defined in resourcesearchfilterfield. filter values are <field><operator><value> or <field><operator><values> with soql operators valid for the field type and an appropriate value or values for the field type. When fuzzy matching is enabled and the filter is defined to be fuzzy, non-matching values can be returned from the SOQL query and weighted according to the user's preference. If the user preference indicates "Essential" then an exact match is performed.
additionalSemiJoinFilters List<ResourceSearchService.SemiJoinFilter> refines search results using related lists consisting of the related object, relationship field (the resource (contact) object), the field to search containing the relevant id, and the id.
skillSets List<list<ResourceSearchService.SkillRating>> a list of lists containing sets of skills. each "skill set" (inner list) is an and operation, while each member of the "skill set" (inner list) are "or" operations.
applyStaffingPermissionControls Boolean if set to true, then staffing permission controls are factored into the results and returns only resources the user has staffing permissions for.
resourceIds Set<Id> a set of resource ids by which the search should be limited.
disableSharingModel Boolean if set to true, the api will bypass the sharing model.
disableSecurityOnReturnedData Boolean if set to true, then crud and field-level security (fls) are applied to returned data fields. If set to false (default) an error is thrown if the user does not have the required permissions.
disableSecurityOnSearchCriteria Boolean if set to true, then crud and field-level security (fls) are disabled for data fields used to filter results. If set to false (default) an error is thrown if the user does not have the required permissions.
regionFilter ID searches for resource records in a region. note that you cannot use this property in conjunction with regionsfilter.
regionsFilter Set<ID> searches for resource records in a set of regions. note that you cannot use this property in conjunction with regionfilter.
includeSubregions Boolean includes sub-regions included under the region(s) searched.
practiceFilter ID searches for resource records in a practice. note that you cannot use this property in conjunction with practicesfilter.
practicesFilter Set<ID> searches for resource records in a set of practices. note that you cannot use this property in conjunction with practicefilter.
includeSubpractices Boolean includes sub-practices included under the practice searched.
groupFilter ID searches for resource records in a group. note that you cannot use this property in conjunction with groupsfilter.
groupsFilter Set<ID> searches for resource records in a set of groups. note that you cannot use this property in conjunction with groupfilter.
includeSubgroups Boolean includes sub-groups included under the group searched.
utilizationStartDate Date specifies the start date for when you need the resource.
utilizationEndDate Date specifies the end date for when you need the resource.
utilizationIncludeBillableAssignments Boolean set to false to exclude billable assignments from the resource search. by default, this value is true.
utilizationIncludeCreditedAssignments Boolean set to false to exclude credited assignments from the resource search. by default, this value is true.
utilizationIncludeExcludedAssignments Boolean set to false to exclude excluded assignments from the resource search. by default, this value is true.
utilizationIncludeNonBillableAssignments Boolean set to false to exclude non-billable assignments from the resource search. by default, this value is true.
utilizationIncludeHeldResourceRequests Boolean set to false to exclude held resource requests from the resource search. by default, this value is true.
utilizationMinimumHoursAvailable Decimal specifies a numeric value specifying the minimum number hours. note that you cannot use this property in conjunction with the utilizationNoMinimumAvailabilityRequirements global variable.
utilizationMinimumAvailability Decimal specifies percentage of minimum availability. note that you cannot use this property in conjunction with the utilizationNoMinimumAvailabilityRequirements global variable.
utilizationAppliedConjunctionAnd Boolean by default, if both utilizationminimumhoursavailable and utilizationminimumavailability are supplied then both conditions must be met. Set this value to false to retrieve resources that meet either condition. Note that you cannot use this property in conjunction with the utilizationNoMinimumAvailabilityRequirements global variable.
utilizationNoMinimumAvailabilityRequirements Boolean by default, you must supply either the utilizationminimumhoursavailable or the utilizationminimumavailability global variable to generate utilization data. Set this value to true to generate utilization data for all matching resources. Note that you cannot use this property in conjunction with the utilizationMinimumAvailability, utilizationMinimumAvailability, or utilizationAppliedConjunctionAnd global variables.
assignments ResourceSearchService.Assignments retrieve assignments that are assigned to the resource.
isAssigned Boolean when this variable is set to true, the api uses (data_assigned__c fields = true) to query the utilization_engine_tod__c and returns the resources with assignments in the requested time frame global variable.
isCalendared Boolean when this variable is set to true, the api uses (data_calendar__c fields = true) to query the utilization_engine_tod__c and returns the calendared resources who have working hours in the requested time frame global variable.
isHeld Boolean when this variable is set to true, the api uses (data_held__c fields = true) to query the utilization_engine_tod__c and returns resources that have held resource request in the requested time frame global variable.
startTimeOfDay DateTime specifies the start time of the day when you need the resource
endTimeOfDay DateTime specifies the end time of the day when you need the resource
requests ResourceSearchService.ResourceRequests retrieve held resource requests that are assigned to the resource.
workedWithCustomerBefore Boolean flag to filter by resources who have/have not been assigned to a project for a specific account id.
enableFuzzyMatching Boolean flag to filter resources by using fuzzy matching.
workedWithCustomerAccId Id the id of the account to be used in conjunction with workedwithcustomerbefore.
elevateToWithoutSharing Boolean deprecated: see disablesharingmodel
applySecurityToReturnedData Boolean deprecated: see disablesecurityonreturneddata
applySecurityToSearchCriteria Boolean deprecated: see disablesecurityonsearchcriteria

Methods

ResourceSearchFilter

global ResourceSearchFilter()

A default no args constructor

ResourceSearchService.ResourceSearchFilterField

global class ResourceSearchFilterField

Defines the Resource fields to use as filters for the search.

Properties

Name Type Description
field sObjectField defines the field to search.
operator String defines the operator. must be appropriate for the field (see the salesforce soql documentation for more about soql comparison operators ).
value Object defines the value to search for. must be appropriate for the field. note that this property should not be used with the values property.
values Set<Object> defines values to search for. must be appropriate for the field. note that this property cannot be used with the value property.
fuzzyMatch Boolean set to true to apply fuzzy matching to the related field, if supported.

Methods

ResourceSearchFilterField

global ResourceSearchFilterField()

A default no args constructor

ResourceSearchFilterField

global ResourceSearchFilterField(sObjectField field, String operator, Object value, Boolean fuzzyMatch)

A general constructor that takes the default fields

Input Parameters

Name Type Description
field sObjectField - any sObjectField found on the contact SObject to search against
operator String - any valid SOQL comparison operator for this field type
value Object - any object specifying the value qualifying as a match (must match data type of field)
fuzzyMatch Boolean - true if a fuzzy match should be performed on this field

ResourceSearchFilterField

global ResourceSearchFilterField(sObjectField field, Set<Object> values, Boolean fuzzyMatch)

A constructor that takes the default parameters that the field must match

Input Parameters

Name Type Description
field sObjectField - any sObjectField found on the contact SObject to search against
values Set<Object> - set of objects specifying the values that qualify as a match (must match data type of field)
fuzzyMatch Boolean - true if a fuzzy match should be performed on this field

ResourceSearchFilterField

global ResourceSearchFilterField(sObjectField field, String operator, Object value)

A general constructor that takes a field and the value it must match

Input Parameters

Name Type Description
field sObjectField - any sObjectField found on the contact SObject to search against
operator String - any valid SOQL comparison operator for this field type
value Object - any object specifying the value qualifying as a match (must match data type of field)

ResourceSearchFilterField

global ResourceSearchFilterField(sObjectField field, Set<Object> values)

A constructor that takes a field and a set of values that the field must match

Input Parameters

Name Type Description
field sObjectField - any sObjectField found on the contact SObject to search against
values Set<Object> - set of objects specifying the values that qualify as a match (must match data type of field)

ResourceSearchFilterField

global ResourceSearchFilterField(Schema.SObjectField field, String operator, Set<Object> values, Boolean fuzzyMatch)

A constructor that takes a field, a SOQL comparison operator and a set of values that the field must match

Input Parameters

Name Type Description
field Schema.SObjectField - An SObjectField found on the Contact SObject to search against
operator String - Any valid SOQL comparison operator for this field type
values Set<Object> - Set of objects specifiying the values that qualify as a match (must match data type of field)
fuzzyMatch Boolean - true if a fuzzy match should be performed on this field

ResourceSearchFilterField

global ResourceSearchFilterField(Schema.SObjectField field, String operator, Set<Object> values)

A constructor that takes a field, a SOQL comparison operator and a set of values that the field must match

Input Parameters

Name Type Description
field Schema.SObjectField - An SObjectField found on the Contact SObject to search against
operator String - Any valid SOQL comparison operator for this field type
values Set<Object> - Set of objects specifiying the values that qualify as a match (must match data type of field)

ResourceSearchService.SemiJoinFilter

global class SemiJoinFilter

defines a related list to be used as a filter in the search.

Properties

Name Type Description
relatedObject SObjectType defines the related object.
relationshipField SObjectField defines the relationship field. normally resource__c or contact__c. this is the field that looks up the contact object
searchField SObjectField defines the field in which to search for the given values.
values Set<Id> defines the values for which to search.

Methods

SemiJoinFilter

global SemiJoinFilter()

A default no args constructor

SemiJoinFilter

global SemiJoinFilter(sObjectType relatedObject, sObjectField relationshipField, sObjectField searchField, Set<Id> values)

A general constructor taking all parameters

Input Parameters

Name Type Description
relatedObject sObjectType - The related sObject to search against
relationshipField sObjectField - The lookup field on the relatedObject that references the contact sObject
searchField sObjectField - A lookup field on the relatedObject that will be searched against
values Set<Id> - The Id values that qualify as a match

ResourceSearchService.SkillRating

global class SkillRating

Defines a skill rating to be used in conjunction with skills filters.

Properties

Name Type Description
skillID ID the id of the skill for which to search
rating String the minimum skill rating required to qualify as a match. if null, matches are based on skill without evaluating specific ratings.
alternativeRatingField sObjectField the field from the skill_certification_rating__c on which to search ratings. If null, the Rating__c field is used.
matchGreaterThanRatings Boolean includes skill ratings greater than the specified rating. when false, searches for specified ratings must match the exact rating. Note that you cannot use this property in conjunction with operator or a null rating.
operator String defines the operator. must contain an appropriate value for the field (see the Salesforce SOQL Documentation for more about soql comparison operators). Note that you cannot use this property in conjunction with matchGreaterThanRatings or a null rating. If the rating is 'None', then the only valid operators are '=' (equal) or '!=' (not equal).

Methods

SkillRating

global SkillRating()

A default no args constructor.

SkillRating

global SkillRating(ID skillID, String rating)

A constructor taking the Skill ID and Skill Rating values.

Input Parameters

Name Type Description
skillID ID - The ID of the Skill for which to search
rating String - The minimum skill rating required to qualify as a match (use null to match all ratings)

SkillRating

global SkillRating(ID skillID, String rating, sObjectField alternativeRatingField, Boolean matchGreaterThanRatings)

A constructor using the Skill ID, Skill Rating, Alternative Rating Field, and Match Greater Than Rating values.

Input Parameters

Name Type Description
skillID ID - The ID of the Skill for which to search
rating String - The minimum skill rating required to qualify as a match (use null to match all ratings)
alternativeRatingField sObjectField - The Skill_Certification_Rating__c field on which to search ratings.
matchGreaterThanRatings Boolean - Includes skill ratings greater than the specified rating.

SkillRating

global SkillRating(ID skillID, String rating, sObjectField alternativeRatingField, Boolean matchGreaterThanRatings, String operator)

A constructor using the Skill ID, Skill Rating, Alternative Rating Field, Match Greater Than Rating, and Operator values.

Input Parameters

Name Type Description
skillID ID - The ID of the Skill for which to search
rating String - The minimum skill rating required to qualify as a match (use null to match all ratings)
alternativeRatingField sObjectField - The Skill_Certification_Rating__c field on which to search ratings.
matchGreaterThanRatings Boolean - Includes skill ratings greater than the specified rating.
operator String - any valid SOQL comparison operator

ResourceSearchService.Assignments

global class Assignments

Retrieve assignments that are assigned to the Resource.

Properties

Name Type Description
startDate Date the start date for assignments.
endDate Date the end date for assignments.
maxReturned Integer maximum number of assignments to return for a resource.
includeBillable Boolean if enabled, include billable assignments.
includeNonbillable Boolean if enabled, include non-billable assignments.
includeCredited Boolean if enabled, include credited assignments.
includeExcluded Boolean if enabled, include excluded assignments.
includeExcludedFromPlanners Boolean if enabled, include assignments that are excluded from planners.
includeTeamAssignments Boolean if enabled, include team assignments from shift management.
fields Set<String> fields to retrieve from matching assignments.

Methods

Assignments

global Assignments()

A default no args constructor.

Assignments

global Assignments(Date startDate, Date endDate, Integer maxReturned)

A constructor taking the startDate, endDate, and maxReturned values.

Input Parameters

Name Type Description
startDate Date - Start date for assignments
endDate Date - End date for assignments
maxReturned Integer - Maximum number of assignments to return

Assignments

global Assignments(Date startDate, Date endDate, Integer maxReturned, Set<String> fields)

A constructor taking the startDate, endDate, maxReturned, and fields values.

Input Parameters

Name Type Description
startDate Date - Start date for assignments
endDate Date - End date for assignments
maxReturned Integer - Maximum number of assignments to return
fields Set<String> - Fields to retrieve from matching assignments

Assignments

global Assignments(Date startDate, Date endDate, Integer maxReturned, Boolean includeBillable, Boolean includeNonbillable, Boolean includeCredited, Boolean includeExcluded, Set<String> fields)

A constructor taking the startDate, endDate, maxReturned, includeBillable, includeCredited, includeExcluded, and fields values.

Input Parameters

Name Type Description
startDate Date - Start date for assignments
endDate Date - End date for assignments
maxReturned Integer - Maximum number of assignments to return
includeBillable Boolean - If enabled, include billable assignments
includeNonbillable Boolean - If enabled, include non-billable assignments
includeCredited Boolean - If enabled, include credited assignments
includeExcluded Boolean - If enabled, include excluded assignments
fields Set<String> - Fields to retrieve from matching assignments

ResourceSearchService.ResourceRequests

global class ResourceRequests

Retrieve held resource requests that are assigned to the Resource.

Properties

Name Type Description
startDate Date the start date for resource requests.
endDate Date the end date for resource requests.
useScheduleDates Boolean apply date range parameters to schedule dates.
maxReturned Integer maximum number of resource requests to return for a resource.
includeRequestsWithoutSchedules Boolean if enabled, include resource requests that lack schedules.
includeRequestsThatBecameAssignments Boolean if enabled, include resource requests that become assignments.
includeExludedFromPlanners Boolean if enabled, include resource requests that are excluded from planners.
fields Set<String> fields to retrieve from matching resource requests.

Methods

ResourceRequests

global ResourceRequests()

A default no args constructor.

ResourceRequests

global ResourceRequests(Date startDate, Date endDate, Integer maxReturned)

A constructor taking the startDate, endDate, and maxReturned values.

Input Parameters

Name Type Description
startDate Date - Start date for resource requests
endDate Date - End date for resource requests
maxReturned Integer - Maximum number of resource requests to return

ResourceRequests

global ResourceRequests(Date startDate, Date endDate, Integer maxReturned, Set<String> fields)

A constructor taking the startDate, endDate, maxReturned, and fields values.

Input Parameters

Name Type Description
startDate Date - Start date for resource requests
endDate Date - End date for resource requests
maxReturned Integer - Maximum number of resource requests to return
fields Set<String> - Fields to retrieve from matching resource requests

ResourceRequests

global ResourceRequests(Date startDate, Date endDate, Integer maxReturned, Boolean includeRequestsWithoutSchedules, Boolean includeRequestsThatBecameAssignments, Set<String> fields)

A constructor taking the startDate, endDate, maxReturned, includeRequestsWithoutSchedules, includeRequestsThatBecameAssignments and fields values.

Input Parameters

Name Type Description
startDate Date - Start date for resource requests
endDate Date - End date for resource requests
maxReturned Integer - Maximum number of resource requests to return
includeRequestsWithoutSchedules Boolean - If enabled, include resource requests that lack schedules
includeRequestsThatBecameAssignments Boolean - If enabled, include resource requests that become assignments
fields Set<String> - Fields to retrieve from matching resource requests
© Copyright 2009–2021 FinancialForce.com, inc. Confidential – all rights reserved. Various trademarks held by their respective owners.